#!/bin/sh

set -eu

jiapkg_build() {
	cmake -DCMAKE_INSTALL_PREFIX="$JIAPKG_INSTALL_DIR" \
		-DSNAPPY_BUILD_BENCHMARKS=OFF \
		-DSNAPPY_BUILD_TESTS=OFF \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_SHARED_LIBS=ON \
		-Bbuild
	cmake --build build -j"$JIAPKG_JOBS"
}

jiapkg_install() {
	cmake --install build --strip
}

case "$1" in
build) jiapkg_build ;;
install) jiapkg_install ;;
esac
